//
//  JJChatMessageTableViewHeader.swift
//  swiftProject
//
//  Created by yangjian on 2021/12/3.
//

import UIKit



class JJChatMessageTableViewHeader: UIView {
    let juhua = UIActivityIndicatorView.init(style: UIActivityIndicatorView.Style.gray)
    let headerHeight : CGFloat = 16
    let noMoreDataLabel = UILabel.init()
    var launching = true
    
    init() {
        super.init(frame: CGRect.zero)
        juhua.startAnimating()
        self.backgroundColor = UIColor.yellow
        
        self.config()
    }
    required init?(coder: NSCoder) {
        super.init(coder: coder)
    }
    
    func config(){
        self.addSubview(juhua)
        juhua.snp.makeConstraints { make in
            make.centerX.equalTo(self)
            make.centerY.equalTo(self)
        }
        //默认有高度,默认有更多数据
//        self.juhua.isHidden = true
        
        noMoreDataLabel.text = "没有更多消息"
        self.addSubview(noMoreDataLabel)
        noMoreDataLabel.snp.makeConstraints { make in
            make.centerX.equalTo(self);
            make.centerY.equalTo(self);
        }
//        self.noMoreDataLabel.isHidden = true
        
        normal()
    }
    
    func normal() {
        self.launching = false
        self.juhua.isHidden = true
        self.noMoreDataLabel.isHidden = true
    }
    
    func launch() {
        self.launching = true
        self.juhua.isHidden = false
        self.noMoreDataLabel.isHidden = true
    }
    
    func noMoreData(){
        if self.launching {
            self.launching = false
            self.juhua.isHidden = true
            self.noMoreDataLabel.isHidden = false
        }
    }
    
    func changeHeight(){
        
    }
    
}

